#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read()
{
	int res=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){res=(res<<1)+(res<<3)+(c^48);c=getchar();}
	return res*f;
}
void write(int x)
{
	if(x<0)putchar('-'),x=-x;
	if(x>9)write(x/10);
	putchar(x%10+'0');
}
struct node
{
	int nxt,to,w,id;
}e[1000005<<1];
int head[1000005],cnt_edge;
void add_edge(int u,int v,int w,int id)
{
	e[++cnt_edge].to=v;
	e[cnt_edge].w=w;
	e[cnt_edge].id=id;
	e[cnt_edge].nxt=head[u];
	head[u]=cnt_edge;
}
int n;
int sum[114514];
int son[1000005],f[1000005],top[1000005],siz[1000005],dfn[1000005];
int cnt;
int id[1000005];
int dep[114514];
void dfs1(int u,int fa)
{
	siz[u]=1;f[u]=fa;dep[u]=dep[fa]+1;
	for(int i=head[u];i;i=e[i].nxt)
	{
		int v=e[i].to;
		if(v==fa) continue;
		id[e[i].id]=v;
		dfs1(v,u);
		siz[u]+=siz[v];
		if(siz[son[u]]<siz[v]) son[u]=v;
	}
}
void dfs2(int u,int t)
{
	top[u]=t;dfn[u]=++cnt;
	if(son[u]) dfs2(son[u],t);
	for(int i=head[u];i;i=e[i].nxt)
	{
		int v=e[i].to;
		if(v==f[u]||v==son[u]) continue;
		dfs2(v,v);
	}
}
int lca(int x,int y)
{
	while(top[x]!=top[y])
	{
		if(dep[top[x]]<dep[top[y]]) swap(x,y);
		x=f[top[x]];	
	}	
	return dep[x]<dep[y]?x:y;
}
void update(int x,int y,int v)
{
	while(top[x]!=top[y])
	{
		if(dep[top[x]]<dep[top[y]]) swap(x,y);
		sum[dfn[top[x]]]+=v;sum[dfn[x]+1]-=v;
		x=f[top[x]];
	}	
	if(dfn[x]>dfn[y]) swap(x,y);
	sum[dfn[x]]+=v;sum[dfn[y]+1]-=v;
}
int mn[114514];
void dfs3(int u,int fa)
{
	for(int i=head[u];i;i=e[i].nxt)
	{
		int v=e[i].to;
		if(v==fa) continue;
		mn[v]=min(mn[u],e[i].w);
		dfs3(v,u);
	}
}
int u[114514],v[114514],w[114514];
signed main()
{
	freopen("tatooine.in","r",stdin);
	freopen("tatooine.out","w",stdout);
	n=read();
	for(int i=1;i<n;i++)
		u[i]=read(),v[i]=read(),w[i]=read();
	for(int k=1;k<n;k++)
	{
		int ans=0;
		for(int i=0;i<=n;i++) head[i]=0;cnt_edge=0;
		for(int i=1;i<n;i++)
			if(i!=k) add_edge(u[i],v[i],w[i],i),add_edge(v[i],u[i],w[i],i);
		for(int i=1;i<=n;i++)
		{
			for(int j=1;j<=n;j++) mn[j]=1e9;
			dfs3(i,0);
			for(int j=i+1;j<=n;j++)
				if(mn[j]!=1e9)ans+=mn[j];
		}
		write(ans),puts("");
	}
	return 0;
}
